/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.testis.gui.mvc.model.testbed;

import org.testis.gui.mvc.controller.testbed.DirectSerialConfigController;
import org.testis.gui.mvc.controller.testbed.DirectSerialConfigController;
import org.testis.gui.mvc.model.AbstractModel;

/**
 *
 * @author selcuk
 */
public class DirectSerialConfigModel extends AbstractModel {

    private String m_lastError = "";
    private Boolean m_visibility = false;
    private Integer m_Id = 0;
    private String m_name = "";
    private String m_Boundary = "";
    private Integer m_Port = 0;
    private Integer m_DataBit = 0;
    private Integer m_Parity = 0;
    private Integer m_StopBit = 0;
    private Integer m_FlowControl = 0;

    public void setVisibility(Boolean val) {
        if (val == null) {
            return;
        }
        Boolean oldVal = m_visibility;
        m_visibility = val;
        firePropertyChange(DirectSerialConfigController.VISIBLE_PROPERTY,
                oldVal,
                val);
    }

    public Boolean getVisibility() {
        return m_visibility;
    }

    public String getName() {
        return m_name;
    }

    public void setName(String name) {
        if (name == null) {
            name = "";
        }
        String oldName = m_name;
        m_name = name;
        firePropertyChange(DirectSerialConfigController.NAME_PROPERTY,
                oldName,
                name);
    }

    public String getLastError() {
        return m_lastError;
    }

    public void setLastError(String val) {
        if (val == null) {
            val = "";
        }
        m_lastError = val;
        firePropertyChange(DirectSerialConfigController.ERROR_PROPERTY, null,
                m_lastError);
    }

    /**
     * @return the m_Id
     */
    public Integer getId() {
        return m_Id;
    }

    /**
     * @param val the m_Id to set
     */
    public void setId(Integer val) {
        if (val == null) {
            return;
        }
        Integer oldVal = m_Id;
        this.m_Id = val;
        firePropertyChange(DirectSerialConfigController.ID_PROPERTY,
                oldVal,
                val);
    }

    /**
     * @return the m_Boundary
     */
    public String getBoundary() {
        return m_Boundary;
    }

    /**
     * @param val the m_Boundary to set
     */
    public void setBoundary(String val) {
        if (val == null) {
            val = "";
        }
        String oldVal = m_Boundary;
        this.m_Boundary = val;
        firePropertyChange(DirectSerialConfigController.BOUNDARY_PROPERTY,
                oldVal,
                val);
    }

    /**
     * @return the m_Port
     */
    public Integer getPort() {
        return m_Port;
    }

    /**
     * @param val the m_Port to set
     */
    public void setPort(Integer val) {
        if (val == null) {
            return;
        }
        Integer oldVal = m_Port;
        this.m_Port = val;
        firePropertyChange(DirectSerialConfigController.PORT_PROPERTY,
                oldVal,
                val);
    }

    /**
     * @return the m_DataBit
     */
    public Integer getDataBit() {
        return m_DataBit;
    }

    /**
     * @param val the m_DataBit to set
     */
    public void setDataBit(Integer val) {
        if (val == null) {
            return;
        }
        Integer oldVal = m_DataBit;
        this.m_DataBit = val;
        firePropertyChange(DirectSerialConfigController.DATABIT_PROPERTY,
                oldVal,
                val);
    }

    /**
     * @return the m_Parity
     */
    public Integer getParity() {
        return m_Parity;
    }

    /**
     * @param val the m_Parity to set
     */
    public void setParity(Integer val) {
        if (val == null) {
            return;
        }
        Integer oldVal = m_Parity;
        this.m_Parity = val;
        firePropertyChange(DirectSerialConfigController.PARITY_PROPERTY,
                oldVal,
                val);
    }

    /**
     * @return the m_StopBit
     */
    public Integer getStopBit() {
        return m_StopBit;
    }

    /**
     * @param val the m_StopBit to set
     */
    public void setStopBit(Integer val) {
        if (val == null) {
            return;
        }
        Integer oldVal = m_StopBit;
        this.m_StopBit = val;
        firePropertyChange(DirectSerialConfigController.STOPBIT_PROPERTY,
                oldVal,
                val);
    }

    /**
     * @return the m_FlowControl
     */
    public Integer getFlowControl() {
        return m_FlowControl;
    }

    /**
     * @param val the m_FlowControl to set
     */
    public void setFlowControl(Integer val) {
        if (val == null) {
            return;
        }
        Integer oldVal = m_FlowControl;
        this.m_FlowControl = val;
        firePropertyChange(DirectSerialConfigController.FLOWCONTROL_PROPERTY,
                oldVal,
                val);
    }
}
